<?php use_helper('Number'); ?>
<form id="<?php echo PurchaseForm::FORM_NAME; ?>" action="<?php echo SystemUtil::generatePurchaseLink($offer, $movie); ?>" method="POST">  
  <h1>Purchase</h1>
  <div class="content_wrp">

    <h3>Offer Details</h3>
    <?php echo include_partial('global/errorsList', array('forms' => array($form), 'global' => $errorCollector)); ?>

    <div class=" clearfix" id="purchase_detail">
      <div class=" clearfix">
        <div class="left tickets_col"><h4>Tickets</h4></div>
        <div class="left cinema_col"><h4><?php echo $movie->getTitle(); ?> <?php if (strtolower($movie->getRating()) != 'unrated') : ?>[<?php echo $movie->getRating(); ?>]<?php endif; ?></h4></div>
        <div class="right"><h4><?php echo $offer->getTicketPriceFormatted(); ?></h4></div>
      </div>
      <div class=" clearfix table_row">
        <div class="left tickets_col"><p><?php echo $quantity; ?></p></div>
        <div class="left cinema_col"><p>at <span class="profile_link"><a href="<?php echo $cinema->getUrlGmap(); ?>" target="_blank" class="" title="Click to view map" alt="Click to view map"><?php echo $cinema->getName(); ?></a></span>, <?php echo $offer->getMerchantsSessionTime('h:iA l dS F Y'); ?></p></div>
        <div class="right"><p>&nbsp;</p></div>
      </div>
      <?php $ppfee = 0; ?>
      <?php if ($merchant->getBookingFee()) : ?>
      <div class=" clearfix table_row" style="border-bottom: 1px solid #DBDBDB;"></div>
      <div class=" clearfix table_row">
        <div class="left tickets_col"><h4></h4></div>
        <div class="left cinema_col"><p>Plus Payment Processing Fee</p></div>
        <div class="right"><h4>$<?php $ppfee = number_format($merchant->getBookingFee()*$quantity, 2); echo $ppfee; ?></h4></div>
      </div>
      <?php endif; ?>
      <div class=" clearfix table_row" style="border-bottom: 1px solid #DBDBDB;"></div>
      <div class=" clearfix table_row">
        <div class="left tickets_col"><h4></h4></div>
        <div class="left cinema_col"><p>Total charged to account<br /><span style="font-size: 10px;">* Total Payable Inc GST</span> </p></div>
        <div class="right"><h4>$<?php echo number_format((($offer->getTicketPrice()*$quantity)+$ppfee), 2); ?></h4></div>
      </div>           
    </div>
    
    

    <?php if ($offer->getSeatsAvailableCount() > 0) : ?>
    <h3>Payment information</h3>
    
    <div class="clearfix">
      <div class="frmbox left">
        <label class=" clear"><?php echo $form[PurchaseForm::FIELD_EMAIL]->renderLabel(); ?><span class="important">*</span></label>
        <?php echo $form[PurchaseForm::FIELD_EMAIL]->render(array('class' => 'txtfeid_01 clear', 'tabindex' => 11)); ?>
        <p class="info left">Email address to receive your order confirmation.</p>
      </div>
    </div>
    
    <div class="clearfix">
      <div class="frmbox left">
        <label class=" clear"><?php echo $form[PurchaseForm::FIELD_CARD_NAME]->renderLabel(); ?><span class="important">*</span></label>
        <?php echo $form[PurchaseForm::FIELD_CARD_NAME]->render(array('class' => 'txtfeid_01 clear', 'tabindex' => 11)); ?>
        <p class="info left">Name as written on your credit card.</p>
      </div>
      <div class="frmbox left">
        <label class="left"><?php echo $form[PurchaseForm::FIELD_CARD_NUMBER]->renderLabel(); ?><span class="important">*</span></label>
        <?php echo $form[PurchaseForm::FIELD_CARD_NUMBER]->render(array('class' => 'txtfeid_01 clear', 'tabindex' => 12)); ?>
        <p class="info left">Credit card number</p>
      </div>
    </div>

    <div class="clearfix">
      <div class="frmbox left">
        <label class=" clear"><?php echo $form[PurchaseForm::FIELD_CARD_DATE]->renderLabel(); ?><span class="important">*</span></label>
        <?php echo $form[PurchaseForm::FIELD_CARD_DATE]->render(array('class' => 'txtfeid_02', 'tabindex' => 13)); ?>
        <p class="info left">Credit card expiry date in MM/YYYY</p>
      </div>
      <div class="frmbox left">
        <label class="left"><?php echo $form[PurchaseForm::FIELD_CARD_CVN]->renderLabel(); ?><span class="important">*</span></label>
        <?php echo $form[PurchaseForm::FIELD_CARD_CVN]->render(array('class' => 'txtfeid_01 clear', 'tabindex' => 14)); ?>
        <p class="info left">Card verification number on the back your card</p>
      </div>
    </div>

    <div class="frmbox_fl">
      <div class="clear termcondition">
        <?php echo $form[PurchaseForm::FIELD_AGREE_TC]->render(array('tabindex' => 15)); ?> <?php echo $form[PurchaseForm::FIELD_AGREE_TC]->renderLabel(); ?>
      </div>
      <?php if (!$sf_user->isAuthenticated()) : ?>
      <div class="clear termcondition">
          <?php echo $form[PurchaseForm::FIELD_BECOME_MEMBER]->render(array('tabindex' => 16)); ?> <?php echo $form[PurchaseForm::FIELD_BECOME_MEMBER]->renderLabel(); ?>
      </div>
      <?php endif; ?>
      <div class="clear">
        <input name="purchase" type="submit" value="Purchase Now" class="btn blue"/>
      </div>
    </div>
    <?php endif; ?>
  </div>
  <?php echo $form['_csrf_token']->render(); ?>
</form>